import Vue from "vue"
import Router from "vue-router"


Vue.use(Router);

export default new Router({
    mode: "history",
    base: process.env.BASE_URL,
    routes: [{
        path: "*",
        redirect: "/login",
    }, {
        path: "",
        component: () => import("./views/login.vue")
    }, {
      path: "/login",
      component: () => import("./views/login.vue")
    }, {
        path: "/",
        name:  "admin",
        component: () => import("./views/admin.vue"),
        meta: {
          loginRequire: true
        },
        children:[{
            name:  "welcome",
            path: "welcome", //子路由不加xie
            component: () => import("./views/admin/welcome.vue"),
        },{
          name:  "business/category",
          path: "business/category", //子路由不加xie
          component: () => import("./views/admin/category.vue"),
        },{
          name:  "business/course",
          path: "business/course", //子路由不加xie
          component: () => import("./views/admin/course.vue"),
        },{
          name:  "business/chapter",
          path: "business/chapter", //子路由不加xie
          component: () => import("./views/admin/chapter.vue"),
        },{
          name:  "business/section",
          path: "business/section", //子路由不加xie
          component: () => import("./views/admin/section.vue"),
        },{
          name:  "business/content",
          path: "business/content", //子路由不加xie
          component: () => import("./views/admin/content.vue"),
        },{
          name:  "business/teacher",
          path: "business/teacher", //子路由不加xie
          component: () => import("./views/admin/teacher.vue"),
        },{
          name:  "business/member",
          path: "business/member", //子路由不加xie
          component: () => import("./views/admin/member.vue"),
        },{
          name:  "business/sms",
          path: "business/sms", //子路由不加xie
          component: () => import("./views/admin/sms.vue"),
        },{
          name:  "file/file",
          path: "file/file", //子路由不加xie
          component: () => import("./views/admin/file.vue"),
        },{
          name:  "system/user",
          path: "system/user", //子路由不加xie
          component: () => import("./views/admin/user.vue"),
        },{
          name:  "system/resource",
          path: "system/resource", //子路由不加xie
          component: () => import("./views/admin/resource.vue"),
        },{
          name:  "system/role",
          path: "system/role", //子路由不加xie
          component: () => import("./views/admin/role.vue"),
        }]
    }]
})